package std

import "strings"

// FileName 将文件名转为合法的文件名
func FileName(filename string) string {
	filename = strings.ReplaceAll(filename, "/", "_")
	filename = strings.ReplaceAll(filename, `\`, "_")
	filename = strings.ReplaceAll(filename, `:`, "_")
	filename = strings.ReplaceAll(filename, `*`, "_")
	filename = strings.ReplaceAll(filename, `?`, "_")
	filename = strings.ReplaceAll(filename, `"`, "_")
	filename = strings.ReplaceAll(filename, `<`, "_")
	filename = strings.ReplaceAll(filename, `>`, "_")
	filename = strings.ReplaceAll(filename, `|`, "_")
	return filename
}
